<template>
<div>
  <h1>订单页面</h1>
  <table border="1" cellpadding="1">
    <tr>
      <td>商品</td>
      <td>价钱</td>
      <td>订单号</td>
      <td>下单时间</td>
      <td>操作</td>
    </tr>
    <tr v-for="i in list">
      <td>{{i.goods}}</td>
      <td>{{i.price}}</td>
      <td>{{i.Ordernum}}</td>
      <td>{{i.btime}}</td>
      <td  v-if="i.state==1">
        <button @click="add(i.id)">支付</button></td>
      <td v-else>
        <button :disabled="true">已购买</button></td>
    </tr>
  </table>



</div>
</template>

<script>
export default {
  name: "shop",
  data(){
    return{
      userid:localStorage.getItem('userid'),
      list:[]
    }
  },
  methods:{
    show(){
      this.$axios.get('users/UorderList_API/?userid='+this.userid)
      .then(i=>{
        this.list = i.data.list
      })
    },
    add(id){
      this.$axios.put('users/UorderList_API/?userid='+this.userid+'&id='+id)
      .then(i=>{
        this.show()

      })
    }
  },
  mounted() {
    this.show()
  }
}
</script>

<style scoped>

</style>
